Passed
Pull Request — master (#17)
by
unknown
02:50
created

Selectors.ts ➔ selectHighLightedNodes   A

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
1
import { select } from 'd3-selection';
2
import { LabelColors, Selectors } from '../AppConsts';
3
import { DependencyLink, DependencyNode } from '../../components/types';
4
5
export function selectHighLightedNodes() {
6
    return selectAllNodes().filter(function(this: SVGGElement) {
7
        return this.firstElementChild ? this.firstElementChild.getAttribute('fill') !== LabelColors.DEFAULT : false;
8
    });
9
}
10
11
export function selectAllNodes() {
12
    return select(Selectors.LABELS).selectAll<SVGGElement, DependencyNode>('g');
13
}
14
15
export function selectAllLinks() {
16
    return select(Selectors.LINKS).selectAll<SVGPathElement, DependencyLink>('path');
17
}
18
19
export function selectHighlightBackground() {
20
    return select(Selectors.HIGHLIGHT_BACKGROUND);
21
}
22
23
export function selectDetailsButtonWrapper() {
24
    return select(Selectors.DETAILS_BUTTON);
25
}
26
27
export function selectDetailsExitButtonWrapper() {
28
    return select(Selectors.DETAILS_EXIT_BUTTON);
29
}
30
31
export function selectDetailsButtonRect() {
32
    return selectDetailsButtonWrapper().select('rect');
33
}
34
35
export function selectDetailsButtonText() {
36
    return selectDetailsButtonWrapper().select('text');
37
}
38
39
export function selectDetailsViewContainer() {
40
    return select(Selectors.DETAILS_VIEW_CONTAINER);
41
}
42
43
export function selectDetailsContainerDiv() {
44
    return select(Selectors.DETAILS_CONTAINER_DIV);
45
}
46
47
export function selectDetailsZoom() {
48
    return select(Selectors.ZOOM_DETAILS);
49
}
50